#ifndef _FIFO_STRREAM_BUFFER_H
#define _FIFO_STRREAM_BUFFER_H

#include "avStruct.h"
#include "avPool.h"

#define BLOCK_ALLOW 1
#define BLOCK_DENY  0

#define BUF_DATA_BASE                   0x00001000
#define BUF_DATA_VIDEO                 0x00001010  
#define BUF_CONTROL_BASE             0x01000000
#define BUF_CONTROL_VIDEO_BASE 0x02000000


#define PRIOR_FIFO_CMD_NORMAL   0x0
#define PRIOR_FIFO_CMD_FIRST       0x1  //cmd insert before data
#define PRIOR_FIFO_CMD_HIGHEST  0x2  

struct Fifo_buffer
{
	tFifoBuffer               *next;
	tFifoElement           *first;
	tFifoElement           *last;
	int                              fifo_size;
	int                              dt_size;     //buffer data size ( no include commad element)
	pthread_mutex_t    mutex;
	pthread_cond_t      not_empty;
	
  	void (*put) (tFifoBuffer *fifo, tFifoElement *buf);	
 	tFifoElement* (*get) (tFifoBuffer *fifo, int block);
	
//	tFifoElement* (*get_timeout) (tFifoBuffer *fifo, int block);
//	tFifoElement* (*getpriorcmd)(tFifoBuffer *fifo, int block);
//  	tFifoElement* (*clear) (tFifoBuffer *fifo) ;	
//	tFifoElement* (*dtclear) (tFifoBuffer *fifo) ;
//	void (*insert) (tFifoBuffer *fifo, tFifoElement *buf, int flag);
//	void (*sendcmd)(tFifoBuffer* fifo, int cmd, int prior);

	void (*destroy) (tFifoBuffer *fifo);
	int    (*size)(tFifoBuffer *fifo) ;
	
//	int (*dtsize)(tFifoBuffer *fifo) ;
//	int (*IsCmdArrive)(tFifoBuffer *fifo) ;
};



tFifoBuffer* fifo_buffer_init(void);

#endif

